<style lang="css"></style>
<template>
    <h2>{{ user.getName }} , {{ user.getAge }}</h2>
    <h2> count : {{ count.getCount }}</h2>
    <button @click="countAdd()">Count add</button>
    <button @click="updateAge(30)">修改年龄</button>
</template>
<script setup lang="ts">
import { countStore, userStore } from '../store';

const count = countStore(); // 从 状态管理中读取的 共享的

const user = userStore();
const countAdd = () => {
    count.increament();
}

const updateAge = (age: number) => {
    user.setAge(age);
}
</script>